package io.xccit.controller;

import io.xccit.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @author CH_ywx
 * @Date 2023-03-31
 * @Description Rest风格请求测试类
 */
@Controller
public class RestTestController {
    @RequestMapping(value = "/user",method = RequestMethod.GET)
    public String getAllUser(){
        System.out.println("查询所所有user");
        return "success";
    }
    @RequestMapping(value = "/user/{id}",method = RequestMethod.GET)
    public String getUserByID(@PathVariable Integer id){
        System.out.println("查询ID为1的用户");
        System.out.println("获取到的id:"+id);
        return "success";
    }
    @RequestMapping(value = "/user",method = RequestMethod.POST)
    public String saveUser(){
        return "success";
    }
    @RequestMapping(value = "/user",method = RequestMethod.PUT)
    public String updateUser(){
        return "success";
    }
    @RequestMapping(value = "/user/{id}",method = RequestMethod.DELETE)
    public String deleteUser(@PathVariable Integer id){
        System.out.println("接收到的id:"+id);
        return "success";
    }
}
